#include<stdio.h>
typedef struct stu
{
	char name[120];
	double a;
	double b;
	double c;
	double avg;
}stu;
int main()
{
	stu s[20];
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%s%lf%lf%lf",s[i].name,&s[i].a,&s[i].b,&s[i].c);
		s[i].avg=(s[i].a+s[i].b+s[i].c)/3.0;
	}
	double max=s[0].avg;
	for(int i=0;i<n;i++)
	{
		printf("%.2lf\n",s[i].avg);
		if(max<s[i].avg)
		{
			max=s[i].avg;
		}
	}
	for(int i=0;i<n;i++)
	{
		if(s[i].avg==max)
		{
			printf("%s %.2lf\n",s[i].name,s[i].avg);
		}
	}
	return 0;
}
